tools/hotplug: fix conditions in systemd service files for dom0
authorOlaf Hering <olaf@aepfle.de>
Fri, 24 Oct 2014 14:17:04 +0000 (16:17 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 27 Oct 2014 10:13:17 +0000 (10:13 +0000)
commitaa5c183614f56fc833c283b3c18670de79ad13d9
tree6a22b16b95bf6f0cc9d1a8923dcf220f66c47094
parent67d95d0e6a96f274b0a85c7eec0e6fe4c03ef0bf
tools/hotplug: fix conditions in systemd service files for dom0

ConditionVirtualization= checks if systemd runs in some sort of guest.
It is not supposed to detect host capabilities. The current
implementation happens to work because systemd-detect-virt from v208
returns also 'xen' in a dom0. In v210 and later 'none' is returned and
no service files will be started.

Adjust the checks to detect a dom0 vs. native boot. Mounting xenfs
depends on /proc/xen, but should only be done for pvops because xenfs
exists only there. All other service files should not be started in
domU. The file /proc/xen/capabilities exists in both dom0 and domU in a
pvops kernel, but only in dom0 it contains 'control_d'. The existing
ExecStartPre= check will prevent starting in a domU.

ConditionVirtualization=!xen is true in a dom0. But this check is broken
in systemd v208, so its not used.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/hotplug/Linux/systemd/proc-xen.mount.in
tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
tools/hotplug/Linux/systemd/xen-watchdog.service.in
tools/hotplug/Linux/systemd/xenconsoled.service.in
tools/hotplug/Linux/systemd/xendomains.service.in
tools/hotplug/Linux/systemd/xenstored.service.in
tools/hotplug/Linux/systemd/xenstored.socket.in
tools/hotplug/Linux/systemd/xenstored_ro.socket.in